﻿using System;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arr = new int[5];
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                Console.WriteLine("输入第" + (i + 1) + "个数");
                int num = int.Parse(Console.ReadLine());
                arr[i] = num;
            }
            //ref:
            //int sum = 0;
            //int max = arr[0];
            //int min = arr[0];
            //int avg = 0;
            //a(ref max, ref min, arr, ref sum, ref avg);
            //Console.WriteLine("最大值：{0}，最小值：{1},和：{2}，平均值：{3}",max,min,sum,avg);

            //out:
            int sum;
            int avg;
            int max;
            int min;
            Outb(out max, out min, out sum, out avg, arr);
            Console.WriteLine("最大值：{0}，最小值：{1},和：{2}，平均值：{3}", max, min, sum, avg);
        }
        static void a(ref int max, ref int min, int[] arr, ref int sum, ref int avg)
        {
            for (int i = 0; i < arr.Length; i++)
            {
                if (max < arr[i])
                {
                    max = arr[i];
                }
                if (min > arr[i])
                {
                    min = arr[i];
                }
                sum = sum + arr[i];
            }
            avg = sum / 5;
        }
        static void Outb(out int max, out int min, out int sum, out int avg, int[] arr)
        {
            max = arr[0];
            min = arr[0];
            sum = 0;
            avg = 0;
            for (int i = 0; i < arr.Length; i++)
            {
                if (max < arr[i])
                {
                    max = arr[i];
                }
                if (min > arr[i])
                {
                    min = arr[i];
                }
                sum = sum + arr[i];
            }
            avg = sum / 5;
        }



    }
}
